package com.axjy.scheduler.controller;

import com.axjy.comm.pojo.TpScheduler;
import com.axjy.comm.vo.Result;
import com.axjy.scheduler.service.SchedulerService;
import com.axjy.scheduler.service.SubmitOrderService;
import com.axjy.scheduler.vo.CreateOrderVo;
import com.axjy.scheduler.vo.SeatPriceVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
public class SchedulerController {

    @Resource
    private SchedulerService schedulerService;

    @Resource
    private SubmitOrderService submitOrderService;

    @RequestMapping("/p/queryItemScheduler")
    public Result queryItemScheduler(@RequestBody TpScheduler tpScheduler){
        List<TpScheduler> list=schedulerService.queryItemScheduler(tpScheduler.getItemId());
        return Result.success(list);
    }

    @RequestMapping("/p/queryItemPrice")
    public Result queryItemPrice(@RequestBody SeatPriceVo seatPriceVo){
        List<SeatPriceVo> list=schedulerService.queryItemPrice(seatPriceVo.getScheduleId());
        return Result.success(list);
    }

    @PostMapping("/v/createOrder")
    public Result createOrder(@RequestBody CreateOrderVo createOrderVo){
        Map<String,String> map=submitOrderService.submitOrder(createOrderVo);
        return Result.success(map);
    }


}
